//
//  LCDayAndNightCell.m
//  TheLCNews
//
//  Created by apple on 15/12/7.
//  Copyright © 2015年 LC. All rights reserved.
//

#import "LCDayAndNightCell.h"

@implementation LCDayAndNightCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.nameLabel];
        
        
        self.switchView = [[UISwitch alloc] init];
        [self.switchView addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.switchView];
        
    }
    
    return self;
    
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.nameLabel.frame = CGRectMake(10, 8, CWIDTH -100, 40);
    self.nameLabel.text = @"日间模式";
    self.switchView.frame = CGRectMake(CWIDTH - 60 , 8, 60, 40) ;
    
    
}

-(void)click{
    
    if (self.switchView.on == 0) {
        self.window.alpha = 1;
        self.nameLabel.text = @"日间模式";
    }else{
        
        self.window.alpha = 0.5;
        self.nameLabel.text = @"夜间模式";
    }
    
    
    
    
}






/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
